/**
 * 
 */
package com.ocean4.socialmap.common;

import java.sql.Timestamp;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * @author MrHung
 * 
 */
public class AppPreferences {
	private static final String APP_SHARED_PREFS = "Your_preferences";
	private SharedPreferences appSharedPrefs;
	private Editor prefsEditor;
	private Context context;

	public AppPreferences(Context context) {
		this.appSharedPrefs = context.getSharedPreferences(APP_SHARED_PREFS,
				Context.MODE_PRIVATE);
		this.prefsEditor = appSharedPrefs.edit();
		this.context = context;
	}

	// Couple for store last sync profile timestamp.
	public Timestamp getLastSyncProfile() {
		String timeString = appSharedPrefs.getString("LastSyncProfile",
				"2013-05-07 00:00:00.00");
		Timestamp timestamp = Timestamp.valueOf(timeString);
		return timestamp;
	}

	public boolean setLastSyncProfile(Timestamp timestamp) {
		prefsEditor.putString("LastSyncProfile", timestamp.toString());
		prefsEditor.commit();
		return true;
	}
}
